Solar power forecasting beneath diverse weather conditions using GD and LM-artificial neural networks

Large-scale solar energy production is still a great deal of obstruction due to the unpredictability of solar power. The intermittent, chaotic, and random quality of solar energy supply has to be dealt with by some comprehensive solar forecasting technologies. Despite forecasting for the long-term, it becomes much more essential to predict short-term forecasts in minutes or even seconds prior. Because key factors such as sudden movement of the clouds, instantaneous deviation of temperature in ambiance, the increased proportion of relative humidity and uncertainty in the wind velocities, haziness, and rains cause the undesired up and down ramping rates, thereby affecting the solar power generation to a greater extent. This paper aims to acknowledge the extended stellar forecasting algorithm using artificial neural network common sensical aspect. Three layered systems have been suggested, consisting of an input layer, hidden layer, and output layer feed-forward in conjunction with back propagation. A prior 5-min te output forecast fed to the input layer to reduce the error has been introduced to have a more precise forecast. Weather remains the most vital input for the ANN type of modeling. The forecasting errors might enhance considerably, thereby affecting the solar power supply relatively due to the variations in the solar irradiations and temperature on any forecasting day. Prior approximation of stellar radiations exhibits a small amount of qualm depending upon climatic conditions such as temperature, shading conditions, soiling effects, relative humidity, etc. All these environmental factors incorporate uncertainty regarding the prediction of the output parameter. In such a case, the approximation of PV output could be much more suitable than direct solar radiation. This paper uses Gradient Descent (GD) and Levenberg Maquarndt Artificial Neural Network (LM-ANN) techniques to apply to data obtained and recorded milliseconds from a 100 W solar panel. The essential purpose of this paper is to establish a time perspective with the greatest deal for the output forecast of small solar power utilities. It has been observed that 5 ms to 12 h time perspective gives the best short- to medium-term prediction for April. A case study has been done in the Peer Panjal region. The data collected for four months with various parameters have been applied randomly as input data using GD and LM type of artificial neural network compared to actual solar energy data. The proposed ANN based algorithm has been used for unswerving petite term forecasting. The model output has been presented in root mean square error and mean absolute percentage error. The results exhibit a improved concurrence between the forecasted and real models. The forecasting of solar energy and load variations assists in fulfilling the cost-effective aspects.

www.nature.com/scientificreports/ fragment of a fresh and realistic signal. In contrast, in order to create signal, input signal of that neuron could be past considerable value, say h, entire signal allied 15 with neuron is derived using relationship given below 16 : A solar cell's voltage and current characteristics under typical weather no current is obtained when there is no load, and the peak voltage detected across a solar cell is referred to as the open circuit voltage (Voc). In contrast, when a solar cell is short-circuited, the voltage across the cell is at its lowest (zero) value, but the current leaving the cell reaches its highest or peak value 17 . The solar photovoltaic cell operates flawlessly when it reaches MPP, which is the point in the curve where the cell produces the most electrical power. The projected values of Vmp and Imp are Voc and Isc, and a PV cell's output current and voltage are significantly dependent on temperature. However, the wattage varies depending on the surrounding temperature. The relationship shown below can be used to determine the 11 photocurrent I ph .
where, I sc is short circuit current, Ki is Coefficient of temperature, Gn represents solar irradiance value = 1000 W/ m 2 , and T n is solar cell temperature.

Arithmetical modelling of ANN for solar output power forecasting
The quandary under concern is the forecasting of solar output power, which is also the desired outcome. The impact on the weighted signal and its correlation with activation function (f), the linear or non-linear output 15 is: The input parameters' values are t, h, and I r and V is target variable, the learning rate is 0.1, and tanh is believed to be activation procedure for artificial neural structure. It includes two hidden layers with 14 neurons, like hi 1 and hi 2 . The weight akin to input h i 1 is denoted by w ij . Similarly, the weights from h i 1 to h i 2 are denoted by θ ij. The weights from h i 2 to the output parameters are given by φ ij . The mathematical interpretation 18 is as follows: X ij denotes the real input values to the hidden layer, W ij is the starting weights assigned as 1, and b1 is biased. The hyperbolic tangent consequent to h i 1 is represented 17 as follows.
Here, i = 1, 2, 3…14, and Oh i 1 are the total nodes' actual output. The representation of weighted function θ ij , with 14 neurons in the next layer 19 , is given by: where, Oh i 1 is consequent output to first hidden layer, θij is initialized weights as one, and b2 is the bias as 1. The relationship can obtain the actual output 12 of hi 2 : Targeted output solar power (OV) in the output layer 20 is given by: Tangent function for the targeted value 15 is represented by: The relationship can complete error 21,22 computations: where, the value of 'n' denotes the output of the neurons and VE represents actual output solar power. The up gradation of weights is performed using the relationships 23-25 as follows: x i w i = w 1 x 1 + w 2 x 2 + · · · + w n x n => total = w T X. (2) (9) OV = tanh(V ). Upgrading weights in its whole continues until the fault is minimised. In a swarm of neural networks, every single lone neuron is referred to as a node, and each output simply behaves like its succeeding neuron's input. In general, the exploitation above might function for each node in a network with "n" number of nodes. Each neuron can be distinguished from the others by the subscript I depending on output and non-linearity, if function, active signals, weights, and inputs are represented 17 by the subscript "i". A sigmoid and stiff limiting facet may also be a part of the very significant non-linear feature. The values fall between 0 and 1. Since the sigmoid function is thought to have non-linearity, monotonicity, an uncomplicated origin, and bounded-like properties, it has gained greater attention for the cause 29 . By the process of learning, the weights and neurons contain useful information. The BPA is said to be the most sophisticated method among the many proposed methods for getting closer to the weights between the input and output. The connection allows for updating each weight during iterations 13,14 : Here, w ij symbolizes the ith and jth neuron, and ƞ (0 and 1) and E indicates the error and can be calculated by the use of the following relationship 14 : where b kj z kj are real and expected values for the neural network. This resemblance applies approximately four signals in conjunction with two invisible layers projecting fifth signal using neural model.

Artificial neural network system
Numerous tasks, including regression and predicting curvature fit, can benefit from neural networks. The artificial neural network will be used in this study as a forecasting model. A neuron is a basic building block of a neural network that utilizes a transfer function to produce an output. Next, each input is given through a weight, which serves as a connection between many layers of neurons and the transfer function to produce the desired output. The extensive structural architecture of the neural network system is depicted in Fig. 1. The network's main goal is to deliver a compressed revelation for the many erratic and patchy data, as opposed to the standard procedures like GD and LM, which devote minimal processing effort and demand prior understanding of statistical estimate among the variables 16 .

Methodology
The stepwise methodology applied is as follows: Data compilation and study location and application of ANN. The data for relative humidity, irradiance, and ambient temperature 27 has been gathered and compiled scrupulously to get the voltage output. Consequently, the input data has been splinted to test and train the data in order to process with the help of an LM-ANN approach. The gathered data for typically sunny and rapidly shifting climatic states of affairs, like partially cloudy, clear sunny day, and rainy day reveals an uncertain behaviour. The Pir Panjal region is that its weather varies and abruptly and unexpectedly. The circuitry was premeditated manually to collect the whole data within time intervals of milliseconds. The collected data elaborates that even a slight alteration in the ambiance 23 can be observed at each moment. The entire range is blessed with enormous and gigantic mountains with a lot of solar power potential, but the abruptly altering weather conditions proffer big challenges to solar power installations. Therefore, such areas need precise model for extra-terrestrial forecasting so that the installed facility can be manoeuvred at utmost efficacy. The extra-terrestrial radiations and the long days can be calculated using relationships in the following equations. The whole setup includes a 100 Wp solar PV panel, a thermometer for observing cell temperature and ambient temperature 24 , and diffused and beam solar radiation measuring devices with their characteristics mentioned in the Table 2. The laboratory setup shown in Fig. 3 for a 12 V battery for the backup system was prepared to avoid any power supply disruption. The area under examination is profoundly subjective of the serene mediterranean environment right through the months of summer and consequently (12)  www.nature.com/scientificreports/ experience desiccated and shrivelled sweltering and sizzling within 3-4 months specifically; rain right through the year is usual. Hence, the western and north-eastern brutal winds manoeuvre the swot locality with soaring precipitation may result in hailstorms and snow as and when with chilly and wet days. The preparation is intended to examine PV panels' broad spectrum and varying characteristics under climatic conditions. Besides, another facet is to mark the best chronological and metrological states for the generation of electrical energy by the PV panels. Designed for a minuscule time extension for forecasting the May, June, July, and August months, the data has been observed in a more detailed 25 way. While, it has been observed that in the range of Pir Panjal, the 3-4 months when the vagueness lasts the most, as the thunderstorms and precipitation are pretty probable. Therefore, ambiguity is at its zenith all through this prediction. The lofty errors 8,30 can be acknowledged as follows.
Here, Isc is the solar constant = 1367 W/m 2 , φ is latitude angle of area to be investigated, δ is the declination angle, ω s is declination, and N is nth day of year. The declination angle can be calculated 9 by: The use of the following relationship can attain the day length 10 : Artificial neural network implementation and its performance. The outline of neural network turns out to be quite essential while predicting global radiations. The neural networking model consists of three layering systems in which the input layer obtains the data collected. The lone output layer produces 12 the information and may make use of one or more than one hidden layer essential for combining both layers via neurons. The output may be predictable by adequately training the input and output data in the ANN approach. GD and LM 15 back propagation algorithms are used in a multiple layer's feed-forward networking system. In this experimentation, the MATLAB 2016 version with three layered feed-forward networks operated with a sigmoid activation function and hidden layers, whereas the output layer uses the linear activation function. Three input variables, like ambient temperature, solar irradiance, and relative humidity, were applied; and output voltage was forecasted as an output. The predicted output by the proposed ANN model is shown in Table 3. The GD and LM-ANN algorithms 17,29 have been applied to forecast the voltage at the output analogous to the collected data on ms basis. Figure 2 shows the neuron training structures. The LM-ANN algorithm features during the training process are listed in Table 1. The equipment and devices used are as follows in Table 2 (Fig. 3).

Normalization, testing, and training
The neural network model engrosses the training of the input parameters by tuning the weights. This aspect intends to get training patterns competent enough to operate in optimum conditions. Furthermore, the model must be sufficiently capable of predicting the new information that does not emerge during the training, generating small errors while the testing set aspires to estimate the neural network performance 23,29 . This action is subjected to the input and output data sets normalized between the range of − 1 to + 1 preceding the training of the input parameters.
Here, X N is the normalized value, X R is the normalization value, X max is the maximum rate, and X min is the lowest rate. After normalization progression, every input parameter is separated into two parts. The first part, called training, consists of 80%, and the second part, called the testing part, neural structure, is composed of 20% of the input variables.

Selection of neurons in the hidden layers
It is hard to choose hidden layer neurons for the neural network. A single hidden layer is adequate for all the diverse functions. The neural network training is mostly initiated with an arbitrary 9 weight assignment. Effectively, the number of neurons in hidden layers must be ascertained to reach the least error at the model's output. The choice depends on both Mean Square Error and 'R' values whenever the first one stays minimum and the later linear correlation coefficient 16 remains high. To accomplish the neurons in the hidden layers, the neurons must be increased until they get united with Mean Square Error. Every single system possesses a solitary input layer and a lone output layer. The number of input parameters in the data processing mechanism is just equivalent to the number of neurons in the input layer. However, the number of outputs associated with every single input (26)  www.nature.com/scientificreports/ is also equivalent to the number of neurons in the output layer. The characteristic number in the data remains equivalent to the number of neurons in the input layer in some exceptional circumstances, for bias, there is only one input layer. Another condition which counts very much is that if the model is behaving like a classifier or a regressor very much depending upon the number of neurons in the output layer. The class labelling of the model also depends upon the condition that if it acts as a classifier, it must possess a lone neuron or might possess manifold neurons but on the contrary, if it behaves like a regressor then the output layer is supposed to have a single neuron. The proposed LM-ANN approach creates R = 0.90, which means that if R > 0.90, the forecasted values with higher numbers are remarkably analogous to the collected data values. Thus, in this work, the LM-ANN approach 18 has been preferred to conclude the selection of the total number of hidden layer neurons. The results show the least Mean Square Error 20,25 , and the maximum 'R-value was obtained at 14 neurons through both the testing and training stages, thereby confirming the exceptional Performance of the LM-ANN approach. Therefore, 14 neurons in the hidden layers are confirmed to be more fitting 5 to predict the output voltage presented in Figs. 4, 5, and 6 for partially cloudy, rainy, and sunny days with the lowest MSE shown in Fig. 10a-c.   Informed consent. Informed consent was obtained from all individual participants included in the study.

Results and discussion
The LM-ANN model performances can be adjudged by the values of Mean Absolute Error, Root Mean Square Error and Co-efficient of correlation (R) 19,27 by using the following relationships: Here, N is the entire data, Xi is the measured output voltage and Yi is the predicted output voltage by the LM-ANN approach. Figure 10a-c present the graphical demonstration of performance or error minimization plots with the lowest error. Figures 4, 5 and 6 compare the actual and predicted solar output voltage (V) waveform for partly cloudy, rainy, and sunny days.

Error analysis
The outcome analysis shows the ease of the model. Nevertheless, the divergence at diverse locations can be evaluated by calculating the determination (C 2 D) and Mean Absolute Percentage Error using the relationships presented in the following equations.
Here, N is the data number, Xi is the measured output, and Yi is the forecasted output by the LM-ANN model. Where mean absolute error provides the measure of resemblance between the measured and forecasted values, the Root Mean Square Error symbolizes the accuracy of the selected LM-ANN model. The Coefficient of correlation (R) value represents the correlation between the two values. If R = 1, then the linear connection between the two 6 values can be acknowledged. Therefore, it can be developed that the model with the least values of Mean Absolute Error and Root Mean Square Error and a larger value of R advocates it as the best model to forecast the input parameters. The performances of the LM-ANN model for training and testing are presented in Table 3. The regression graphs both for the collected data and forecasted values by the LM-ANN 28,31,32 for training and testing are shown in Figs. 7a,b, 8a,b, and 9a,b, correspondingly.
Also, R = 1 represents the perfect linear association between the collected and forecasted values, and R = 0.90 specifies an outstanding harmony 7 between the two values. The proposed LM-ANN model presents 'R' values for both testing and training data as 0.9545 and 0.9272, thereby validating the claim of the LM-ANN approach.The numerical erroneousness divulges the least and maximum C 2 D is 0.9808 and 0.9934, correspondingly. The Coefficient of determination represents the 97.9-98.9% correspondence between the forecasted and measured values by the proposed LM-ANN algorithm. The model performance for a sunny day, partly cloudy day, and rainy day are shown in Fig. 10a-c correspondingly. The MAPE value shows precision in the range of 0.11-4.24%. Therefore, from this mathematical error investigation, it is concluded that the precision of the LM-ANN approach 24 obtained in this work has performed appropriately and absolutely to forecast the voltage at the output for the input parameters such as mean ambient temperature, solar irradiance, and relative humidity. The other characteristic of this approach is that it retorts very precisely and ideally on a shorter note, providing an excellent response with minimized error. (29)

Conclusion
In this work, the LM-ANN algorithm has been designed to forecast the output voltage in the region of Peer Panjal. The two ANN methodologies, GD and LM, were applied for testing and training purposes. The mean ambient temperature, relative humidity, and solar irradiance data were composed by the self-designed circuit in concurrence with Arduino to gather and survey the data at milliseconds. The hastily changing weathering data was used for training and testing the projected algorithm. The varied weather conditions like sunny days, rainy days, and partially cloudy day data were also used to test and train the LM-ANN technique. The reliability of the chosen technique was practically based on MAE, RMSE, and the Coefficient of maximum linear regression (R) value. The experimentation gives a much closer impression between the forecasted and the determined values. It also authenticates the exactness in the forecasting potential of the proposed technique. The numerical error study regarding the determination coefficient offers correspondence close to 98-99%. The MAPE value authenticates better precision too. One more vital aspect advocating the proposed approach is that it offers the promise and proficiency to congregate in a minute to tender, perfect revelation integrated with the slightest error.